package gamebackend;

import java.util.List;

import framework.GraphicsWrapper;


public interface Ship {
	/**
	 * @return whether the ship is not destroyed.
	 */
	public boolean isAlive();
	
	public double getXPosition();
	public void setXPosition(double the_x);
	public double getYPosition();
	/**
	 * @return the Y speed the ship seeks to be at.  The ship
	 * can move slower if it just hit an obstacle and slowed down,
	 * or temporarily faster if it just hit a boost.
	 */
	public double getMinSpeed();
	public double getXVelocity();
	public double getYVelocity();
	public double getXAcceleration();
	public double getYPositionChange(int the_timeDelta);
	
	/**
	 * @return how long the ship has been alive
	 */
	public int getTime();
	public int getBoostCount();
	
	public void boost();
	
	/**
	 * @return how many segments there are in the special meter for this Ship.
	 */
	public int getSpecialSegmentCount();
	public double getSpecialPercent();
	
	/**
	 * Indicate the player missed a boost, so that the ship typically slows down.
	 */
	public void missBoost();
	public void missPowerUp(final PowerUp the_powerUp);
	public void hitPowerUp(final PowerUp the_powerUp);
	public void step(int the_timeDelta, double the_cameraYChange);
	
	/**
	 * Call when the ship collides with the side of a block.
	 * @return whether the block should be destroyed
	 */
	public boolean collidedSide();
	
	/**
	 * Call when the ship hits the bottom of a block.
	 * @return whether the block should be destroyed
	 */
	public boolean collidedBottom();
	
	
	// TODO ships should decide what to do with powerups; no external thing should tell ships to repair
	public void repair(int the_amount);
	
	/**
	 * Checks to see whether the ship is hit by an EnviroLaser, and reacts accordingly.
	 * @param the_left the left edge of the laser
	 * @param the_right the right edge of the laser
	 */
	public void checkEnviroLaser(final double the_left, final double the_right);
	
	public int getHealth();
	public int getMaxHealth();
	
	public void leftThruster(boolean is_on);
	public void rightThruster(boolean is_on);
	public void special(boolean is_on);
	
	public void render(GraphicsWrapper g);
	
	/**
	 * Instructs the ship to move to the given x-position.
	 * State set by leftThruster and rightThruster is disregarded.
	 * @param the_target the x position to move to
	 */
	public void moveTo(double the_target);
	/**
	 * Indicates the user lifts their finger or mouse.  If
	 * the ship ever moves outside of the user's control
	 * and offsets are made to the ships position relative
	 * to the user's desired position, offsets may
	 * be cleared here.
	 */
	public void touchUp();
	/**
	 * Instructs the ship to maintain a velocity of a given
	 * ratio of its max speed.
	 * @param the_ratio between -1 and 1, inclusive
	 */
	public void setDesiredVelocityRatio(final double the_ratio);
	
	/**
	 * Creates a copy of the Ship to be used for FlightPath generation.
	 * As such, the returned ship does not need to render or have
	 * a ShipListener.
	 * @return a duplicate of the Ship.
	 */
	public Ship getCopy();
	
	
	public interface ShipListener {
		public void onShipDestroyed();
	}
	

	
}